From: Hashem Nasarat Date: Fri, 25 Apr 2014 05:09:39 +0000 (-0400) Subject: popupMenu: Force submenu arrow rotation angles to multiples of 90 X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2193 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=dc5618558f9a7cad940db8705792b3f033998e8e;p=gnome-shell.git popupMenu: Force submenu arrow rotation angles to multiples of 90 When you open or close a PopupSubMenu the arrow icon rotates, but the code previously assumed that the starting angle was a multiple of 90. If you click the submenu fast enough the rotation could overlap with the previous rotation and you'd get something that wasn't a multiple of 90. Now we ensure that the ending arrowRotation angle is always a multiple of 90 regardless of what the starting angle is. https://bugzilla.gnome.org/show_bug.cgi?id=728927 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 1694e0a04..be8bbe9d9 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -922,8 +922,10 @@ const PopupSubMenu = new Lang.Class({ let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1); this.actor.height = 0; this.actor._arrowRotation = this._arrow.rotation_angle_z; + let angle = this.actor._arrowRotation; + // animate to the first multiple of 90 greater than current angle Tweener.addTween(this.actor, - { _arrowRotation: this.actor._arrowRotation + 90, + { _arrowRotation: angle - angle % 90 + 90, height: naturalHeight, time: 0.25, onUpdateScope: this, @@ -955,8 +957,10 @@ const PopupSubMenu = new Lang.Class({ if (animate) { this.actor._arrowRotation = this._arrow.rotation_angle_z; + let angle = this.actor._arrowRotation; + // animate to the first multiple of 90 less than current angle Tweener.addTween(this.actor, - { _arrowRotation: this.actor._arrowRotation - 90, + { _arrowRotation: (angle - 1) - (angle - 1) % 90, height: 0, time: 0.25, onUpdateScope: this,